package cn.buk.tms.dao;

import cn.buk.tms.entity.misc.OperationLog;
import cn.buk.tms.entity.misc.PaymentMethod;
import cn.buk.tms.entity.misc.Supplier;
import cn.buk.tms.entity.order.vas.VasOrder;
import cn.buk.tms.sc.SearchFlightOrderCriteria;
import java.util.List;

public interface VasOrderDao extends BaseAbstractDao {

    /**
     * 保存vasOrder
     *
     * @param order 需要保存的内容
     * @return >0 表示成功
     */
    int createVasOrder(VasOrder order);

    /**
     * 根据id获取vasOrder
     */
    VasOrder getOrderById(int id);
    VasOrder getOrderByOrderNo(int enterpriseId, String orderNo);

    /**
     * 根据查询条件查找服务订单
     */
    List<VasOrder> searchVasOrders(int enterpriseId, String username, SearchFlightOrderCriteria sc,
        boolean isAdmin, List<Integer> allowedCustomerIds);

    /**
     * 查找保险订单
     * @param enterpriseId 企业id
     * @param sc 查询条件
     * @param allowedCustomerIds 允许查询哪些客户id列表
     */
    List<VasOrder> searchInsuranceOrders(int enterpriseId, SearchFlightOrderCriteria sc, List<Integer> allowedCustomerIds);

    List<OperationLog> searchVasOrderHistory(int enterpriseId, int orderId);

    int updateVasOrderRemark(int enterpriseId, String username, int orderId, String remark);

    /**
     * 修改订单的供应商及支付方式
     */
    int updateSupplier(int enterpriseId, String username, int orderId, Supplier supplier,
        PaymentMethod pm);

    int cancelVasOrder(int enterpriseId, String username, int orderId, String remark);

    int processVasOrder(int enterpriseId, String username, int orderId, String remark);

    int finishVasOrder(int enterpriseId, String username, int orderId, String remark);

    int updateVasOrderPassenger(int enterpriseId, String username, int orderId, int psgId,
        String psgName, String psgIdNo, String psgRemark);

    int updateVasOrderPassengerSeatNo(int enterpriseId, String username, int orderId, int psgId,
        String psgName, String seatNo);

    int updateVasOrderPaid(int enterpriseId, String username, int orderId, String remark);

    int updateVasOrderPrice(int enterpriseId, String username, int orderId, double price,
        double discount, double cost);

    int updatePaymentMethod(int enterpriseId, String username, int orderId, PaymentMethod o);

    int rollbackVasOrderStatus(int enterpriseId, String username, int id, final String remark);

    List<VasOrder> searchUnpaidOrders(int max);



    /**
     * 根据关联的机票订单id 查找服务订单
     */
    List<VasOrder> searchByFlightOrderId(int enterpriseId, int flightOrderId);

    int updateVaasOrderExternalOrderNo(int enterpriseId, String agentName, int orderId,
        String orderNos);

    int appendVasOrderLog(int enterpriseId, String username, int vasOrderId, String remark);
}
